# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=cl-trivial-features
_pkgname="${pkgname#cl-}"
pkgver=1.0.r3.g35c5eeb
pkgrel=2
pkgdesc='Ensure consistent features across multiple Common Lisp implementations'
arch=('any')
url='https://github.com/trivial-features/trivial-features'
license=('MIT')
depends=('common-lisp' 'cl-asdf')
makedepends=('git')
checkdepends=('sbcl' 'cl-rt' 'cl-cffi' 'cl-alexandria')
_commit='35c5eeb21a51671ffbfcb591f84498e782478a32'
source=(
  "$pkgname::git+$url#commit=$_commit"
  'run-tests.lisp'
)
b2sums=('SKIP'
        '6c7d4182131c8fea9efa23bb196200076c72b4d07caa88e01ea96a0ab9f12b8e4c20bff16fb2eec0630cb8907a274593b405a29193c7adc4bb2924a55213f4a4')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./g'
}

check() {
  cd "$pkgname"

  sbcl --script ../run-tests.lisp
}

package() {
  cd "$pkgname"

  # library
  install -vd "$pkgdir/usr/share/common-lisp/source/$_pkgname"
  cp -vr \
    src tests \
    ./*.{lisp,asd} \
    "$pkgdir/usr/share/common-lisp/source/$_pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" ./*.md

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" COPYRIGHT
}
